import { VideoHistory } from "src/entities/video-history.entity";

// view-history.dto.ts
export class VideoHistoryItemDto {
    id: number; // 确保包含历史记录ID
    videoId: number;
    title: string;
    coverUrl: string;
    creatorName: string;
    viewTime: Date;
    
    static fromEntity(history: VideoHistory): VideoHistoryItemDto {
      return {
        id: history.id,
        videoId: history.video.video_id,
        title: history.video.title,
        coverUrl: history.video.cover_url || '/default-cover.jpg',
        creatorName: history.video.user.username,
        viewTime: history.createdAt,
      };
    }
  }
  
  export class PaginatedHistoryDto {
    items: VideoHistoryItemDto[];
    total: number;
    currentPage: number;
    totalPages: number;
  }